# -*- ecoding: utf-8 -*-
# @ModuleName: run
# @Author: wangwei 
# @Time: 2023/10/18 10:57
import os

import sys

import pytest

from common.file_load import read_yaml, write_yaml

if __name__ == '__main__':
    params=sys.argv
    if len(params)>1:
        env_name=params[1]
        if env_name not in ('sit','uat','test'):
            env_name="sit"
        common_content={}
        http_content={}
        db_content={}
        redis_content={}
        content=read_yaml(f"/config/env_{env_name}.yml")
        common_content['common']=content.get('common')
        print(common_content)
        write_yaml(common_content['common'],"/config/common.yml")
        http_content['http'] = content.get('http')
        print(http_content)
        write_yaml(http_content['http'], "/config/http.yml")
        db_content['db'] = content.get('db')
        print(db_content)
        write_yaml(db_content['db'] , "/config/db.yml")
        redis_content['redis'] = content.get('redis')
        print(redis_content)
        write_yaml(redis_content['redis'], "/config/redis.yml")
        del params[1]
    pytest.main()
    os.system("allure generate report/ -o report/data/ --clean")
    #123123
